/** 
* All Rights Reserved , Copyright (C) 2021 , 青岛鼎信通讯股份有限公司
* 
* SdProjectMilepostServiceAuto
* SD项目策划-里程碑
* 
* 修改纪录
* 2021-12-16 版本：1.0 hudeyong 创建。
* @version 版本：1.0
* @author 作者：hudeyong
* 创建日期：2021-12-16
*/

package com.topscomm.gpm.service.impl.auto;

import javax.annotation.Resource;

import com.topscomm.gpm.pojo.GpmProjectMilepostEntity;
import org.springframework.beans.factory.annotation.Autowired;

import com.topscomm.basic.IBasicDao;
import com.topscomm.gpm.pojo.GpmProjectEntity;
import com.topscomm.pub.util.StringBufferProxy;
import com.topscomm.tap.common.DatacodeCache;

import java.util.List;
import java.util.Map;
import com.topscomm.gpm.*;
import com.topscomm.gpm.service.impl.GpmProjectService;
import com.topscomm.gpm.dao.IGpmProjectMilepostDao;


public class GpmProjectMilepostServiceAuto extends GpmService<GpmProjectMilepostEntity, IGpmProjectMilepostDao> {
	
	@Autowired
	private GpmProjectService gpmProjectService;
	
	/**
	 * @author: hudeyong
	 * @date: 2021-12-16
	 * @param mapRow
	 * @description:设置字段显示值
	 * @modify:
	 */
	@Override
	public void setDispFields(Map<String, Object> mapRow, DatacodeCache datacodeCache) {
		String temp;
		if (mapRow.get("deptcommoncode1") != null) {
			temp = mapRow.get("deptcommoncode1").toString();
			mapRow.put("dispdeptcommoncode1", datacodeCache.getValueDynamic("DeptCommonCode", temp, "code", "name"));
		}
		if (mapRow.get("actualfinishtime") != null) {
			temp = mapRow.get("actualfinishtime").toString();
			mapRow.put("dispactualfinishtime", datacodeCache.getValueDynamic("EhrHonorlevel", temp, "code", "name"));
		}
//		if (mapRow.get("milepoststate") != null) {
//			temp = mapRow.get("milepoststate").toString();
//			mapRow.put("dispmilepoststate", datacodeCache.getValueDynamic("TapApprovalBillState", temp, "code", "name"));
//		}
		if (mapRow.get("newadd") != null) {
			temp = mapRow.get("newadd").toString();
			mapRow.put("dispnewadd", datacodeCache.getValueDynamic("CboYesNo", temp, "code", "name"));
		}
		if (mapRow.get("enabled") != null) {
			temp = mapRow.get("enabled").toString();
			mapRow.put("dispenabled", datacodeCache.getValueDynamic("CboYesNo", temp, "code", "name"));
		}
		if (mapRow.get("milepoststate") != null) {
			temp = mapRow.get("milepoststate").toString();
			mapRow.put("dispmilepoststate", datacodeCache.getValueDynamic("GpmMilePostState", temp, "code", "name"));
		}
//		if (mapRow.get("isdelivery") != null) {
//			temp = mapRow.get("isdelivery").toString();
//			mapRow.put("dispisdelivery", datacodeCache.getValueDynamic("CboYesNo", temp, "code", "name"));
//		}
		if (mapRow.get("projectcode") != null) {
			temp = mapRow.get("projectcode").toString();
			StringBufferProxy sql = new StringBufferProxy();
			sql.appendLineSingle("projectcode = '{0}'",temp);
			List<GpmProjectEntity> sdentities = gpmProjectService
				.queryByWhere(sql.toString());
			mapRow.put("projectname", sdentities.get(0).getProjectname());
		}
	}

	@Override
	@Resource(name = "sdProjectMilepostDao")
	public void setDao(IBasicDao<GpmProjectMilepostEntity> dao) {
		super.setDao(dao);
	}
}
